#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u16)]
pub enum IssueCode {
    AbstractClassUsedAsAttribute,
    AbstractInstantiation,
    AlwaysMatchingSwitchCase,
    AmbiguousClassLikeConstantAccess,
    AmbiguousInstantiationTarget,
    AmbiguousObjectMethodAccess,
    AmbiguousObjectPropertyAccess,
    ArrayAppendInReadContext,
    ArrayToStringConversion,
    AssignmentToConstant,
    AssignmentToThis,
    AttributeNotRepeatable,
    AvoidCatchingError,
    BackedPropertyReferenceHook,
    CatchTypeNotThrowable,
    ClassNotMarkedAsAttribute,
    CloneInsideLoop,
    ConditionIsTooComplex,
    ConflictingReferenceConstraint,
    ConflictingTemplateEqualityBounds,
    DeprecatedClass,
    DeprecatedClosure,
    DeprecatedConstant,
    DeprecatedFeature,
    DeprecatedFunction,
    DeprecatedMethod,
    DeprecatedTrait,
    DirectTraitConstantAccess,
    DocblockTypeMismatch,
    DuplicateArrayKey,
    DuplicateCaughtType,
    DuplicateClosureUseVariable,
    DuplicateNamedArgument,
    DynamicStaticMethodCall,
    EmptyMatchExpression,
    EnumInstantiation,
    EnumIteration,
    ExcessTemplateParameter,
    ExpressionIsTooComplex,
    ExtendFinalClass,
    FalsableReturnStatement,
    FalseArgument,
    FalseIterator,
    FalseOperand,
    GenericObjectIteration,
    HiddenGeneratorReturn,
    ImplicitResourceToStringCast,
    ImplicitToStringCast,
    ImpossibleArrayAccess,
    ImpossibleArrayAssignment,
    ImpossibleAssignment,
    ImpossibleCondition,
    ImpossibleKeyCheck,
    ImpossibleNonnullEntryCheck,
    ImpossibleNullTypeComparison,
    ImpossibleTypeComparison,
    ImpureConstruct,
    ImpureStaticVariable,
    IncompatibleConstantAccess,
    IncompatibleConstantOverride,
    IncompatibleConstantType,
    IncompatibleConstantVisibility,
    IncompatibleParameterCount,
    IncompatibleParameterName,
    IncompatibleParameterType,
    IncompatiblePropertyAccess,
    IncompatiblePropertyDefault,
    IncompatiblePropertyHookParameterType,
    IncompatiblePropertyHookSignature,
    IncompatiblePropertyOverride,
    IncompatiblePropertyReadonly,
    IncompatiblePropertyStatic,
    IncompatiblePropertyType,
    IncompatiblePropertyVisibility,
    IncompatibleReadonlyModifier,
    IncompatibleReturnType,
    IncompatibleStaticModifier,
    IncompatibleTemplateLowerBound,
    IncompatibleVisibility,
    InconsistentTemplate,
    InterfaceInstantiation,
    InvalidArgument,
    InvalidArrayAccess,
    InvalidArrayAccessAssignmentValue,
    InvalidArrayElement,
    InvalidArrayElementKey,
    InvalidArrayIndex,
    InvalidAssignment,
    InvalidAttributeTarget,
    InvalidBreak,
    InvalidCallable,
    InvalidCatchType,
    InvalidCatchTypeNotClassOrInterface,
    InvalidClassConstantOnString,
    InvalidClassStringExpression,
    InvalidClone,
    InvalidConstantSelector,
    InvalidContinue,
    InvalidDestructuringSource,
    InvalidDocblock,
    InvalidEnumCaseValue,
    InvalidExtend,
    InvalidForeachKey,
    InvalidForeachValue,
    InvalidGeneratorReturnType,
    InvalidGlobal,
    InvalidImplement,
    InvalidIssetExpression,
    InvalidIterator,
    InvalidMemberSelector,
    InvalidMethodAccess,
    InvalidNamedArgument,
    InvalidOperand,
    InvalidOverrideAttribute,
    InvalidParentType,
    InvalidPassByReference,
    InvalidPropertyAccess,
    InvalidPropertyAssignmentValue,
    InvalidPropertyRead,
    InvalidPropertyWrite,
    InvalidReturnStatement,
    InvalidScopeKeywordContext,
    InvalidStaticMethodAccess,
    InvalidStaticMethodCall,
    InvalidStaticPropertyAccess,
    InvalidTemplateParameter,
    InvalidThrow,
    InvalidTraitAliasModifier,
    InvalidTraitUse,
    InvalidTypeCast,
    InvalidUnset,
    InvalidYieldKeyType,
    InvalidYieldValueType,
    LessSpecificArgument,
    LessSpecificNestedArgumentType,
    LessSpecificNestedReturnStatement,
    LessSpecificReturnStatement,
    ListUsedInReadContext,
    MatchArmAlwaysTrue,
    MatchDefaultArmAlwaysExecuted,
    MatchExpressionOnlyDefaultArm,
    MatchNotExhaustive,
    MatchSubjectTypeIsNever,
    MethodAccessOnNull,
    MismatchedArrayIndex,
    MissingConstantType,
    MissingMagicMethod,
    MissingOverrideAttribute,
    MissingParameterType,
    MissingPropertyType,
    MissingRequiredInterface,
    MissingRequiredParent,
    MissingReturnStatement,
    MissingReturnType,
    MissingTemplateParameter,
    MixedArgument,
    MixedArrayAccess,
    MixedArrayAssignment,
    MixedArrayIndex,
    MixedAssignment,
    MixedClone,
    MixedDestructuringShape,
    MixedMethodAccess,
    MixedOperand,
    MixedPropertyAccess,
    MixedPropertyTypeCoercion,
    MixedReturnStatement,
    NameAlreadyInUse,
    NamedArgumentAfterPositional,
    NamedArgumentNotAllowed,
    NamedArgumentOverridesPositional,
    NeverMatchingSwitchCase,
    NeverReturn,
    NoValidCatchTypeFound,
    NoValue,
    NonClassUsedAsAttribute,
    NonDocumentedConstant,
    NonDocumentedMethod,
    NonDocumentedProperty,
    NonExistentAttributeClass,
    NonExistentCatchType,
    NonExistentClass,
    NonExistentClassConstant,
    NonExistentClassLike,
    NonExistentConstant,
    NonExistentFunction,
    NonExistentMethod,
    NonExistentProperty,
    NonIterableObjectIteration,
    NonStaticAbstractImplementation,
    NullArgument,
    NullArrayAccess,
    NullArrayIndex,
    NullIterator,
    NullOperand,
    NullPropertyAccess,
    NullableReturnStatement,
    OverrideFinalConstant,
    OverrideFinalMethod,
    OverrideFinalProperty,
    OverrideFinalPropertyHook,
    ParadoxicalCondition,
    ParentOutsideClassScope,
    PossibleMethodAccessOnNull,
    PossiblyFalseArgument,
    PossiblyFalseIterator,
    PossiblyFalseOperand,
    PossiblyInvalidArgument,
    PossiblyInvalidClone,
    PossiblyInvalidIterator,
    PossiblyInvalidOperand,
    PossiblyNonExistentProperty,
    PossiblyNullArgument,
    PossiblyNullArrayAccess,
    PossiblyNullArrayIndex,
    PossiblyNullIterator,
    PossiblyNullOperand,
    PossiblyNullPropertyAccess,
    PossiblyStaticAccessOnInterface,
    PossiblyUndefinedArrayIndex,
    PossiblyUndefinedIntArrayIndex,
    PossiblyUndefinedStringArrayIndex,
    PossiblyUndefinedVariable,
    PropertyTypeCoercion,
    PsalmTrace,
    RedundantCast,
    RedundantComparison,
    RedundantCondition,
    RedundantDocblockType,
    RedundantIssetCheck,
    RedundantKeyCheck,
    RedundantLogicalOperation,
    RedundantNonnullEntryCheck,
    RedundantNonnullTypeComparison,
    RedundantNullCoalesce,
    RedundantNullsafeOperator,
    RedundantTypeComparison,
    ReferenceConstraintViolation,
    ReferenceReusedFromConfusingScope,
    ReferenceToUndefinedVariable,
    SelfOutsideClassScope,
    SkipInKeyedDestructuring,
    SpreadInDestructuring,
    StaticAccessOnInterface,
    StaticOutsideClassScope,
    StringConstantSelector,
    StringMemberSelector,
    TemplateConstraintViolation,
    TooFewArguments,
    TooManyArguments,
    TraitConstantOverride,
    TraitInstantiation,
    TypeConfirmation,
    TypeInspection,
    UndefinedIntArrayIndex,
    UndefinedStringArrayIndex,
    UndefinedVariable,
    UndefinedVariableInClosureUse,
    UnevaluatedCode,
    UnhandledThrownType,
    UnimplementedAbstractMethod,
    UnimplementedAbstractPropertyHook,
    UnknownClassInstantiation,
    UnknownConstantSelectorType,
    UnknownIteratorType,
    UnknownMatchSubjectType,
    UnknownMemberSelectorType,
    UnknownYieldFromIteratorType,
    UnreachableMatchArm,
    UnreachableMatchDefaultArm,
    UnreachableSwitchCase,
    UnreachableSwitchDefault,
    UnsafeInstantiation,
    UnusedFunctionCall,
    UnusedMethodCall,
    UnusedParameter,
    UnusedStatement,
    UnusedTemplateParameter,
    UselessControlFlow,
    WhereConstraintViolation,
    YieldFromInvalidKeyType,
    YieldFromInvalidSendType,
    YieldFromInvalidValueType,
    YieldFromNonIterable,
    YieldOutsideFunction,
}

impl IssueCode {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::AbstractClassUsedAsAttribute => "abstract-class-used-as-attribute",
            Self::AbstractInstantiation => "abstract-instantiation",
            Self::AlwaysMatchingSwitchCase => "always-matching-switch-case",
            Self::AmbiguousClassLikeConstantAccess => "ambiguous-class-like-constant-access",
            Self::AmbiguousInstantiationTarget => "ambiguous-instantiation-target",
            Self::AmbiguousObjectMethodAccess => "ambiguous-object-method-access",
            Self::AmbiguousObjectPropertyAccess => "ambiguous-object-property-access",
            Self::ArrayAppendInReadContext => "array-append-in-read-context",
            Self::ArrayToStringConversion => "array-to-string-conversion",
            Self::AssignmentToConstant => "assignment-to-constant",
            Self::AssignmentToThis => "assignment-to-this",
            Self::AttributeNotRepeatable => "attribute-not-repeatable",
            Self::AvoidCatchingError => "avoid-catching-error",
            Self::BackedPropertyReferenceHook => "backed-property-reference-hook",
            Self::CatchTypeNotThrowable => "catch-type-not-throwable",
            Self::ClassNotMarkedAsAttribute => "class-not-marked-as-attribute",
            Self::CloneInsideLoop => "clone-inside-loop",
            Self::ConditionIsTooComplex => "condition-is-too-complex",
            Self::ConflictingReferenceConstraint => "conflicting-reference-constraint",
            Self::ConflictingTemplateEqualityBounds => "conflicting-template-equality-bounds",
            Self::DeprecatedClass => "deprecated-class",
            Self::DeprecatedClosure => "deprecated-closure",
            Self::DeprecatedConstant => "deprecated-constant",
            Self::DeprecatedFeature => "deprecated-feature",
            Self::DeprecatedFunction => "deprecated-function",
            Self::DeprecatedMethod => "deprecated-method",
            Self::DeprecatedTrait => "deprecated-trait",
            Self::DirectTraitConstantAccess => "direct-trait-constant-access",
            Self::DocblockTypeMismatch => "docblock-type-mismatch",
            Self::DuplicateArrayKey => "duplicate-array-key",
            Self::DuplicateCaughtType => "duplicate-caught-type",
            Self::DuplicateClosureUseVariable => "duplicate-closure-use-variable",
            Self::DuplicateNamedArgument => "duplicate-named-argument",
            Self::DynamicStaticMethodCall => "dynamic-static-method-call",
            Self::EmptyMatchExpression => "empty-match-expression",
            Self::EnumInstantiation => "enum-instantiation",
            Self::EnumIteration => "enum-iteration",
            Self::ExcessTemplateParameter => "excess-template-parameter",
            Self::ExpressionIsTooComplex => "expression-is-too-complex",
            Self::ExtendFinalClass => "extend-final-class",
            Self::FalsableReturnStatement => "falsable-return-statement",
            Self::FalseArgument => "false-argument",
            Self::FalseIterator => "false-iterator",
            Self::FalseOperand => "false-operand",
            Self::GenericObjectIteration => "generic-object-iteration",
            Self::HiddenGeneratorReturn => "hidden-generator-return",
            Self::ImplicitResourceToStringCast => "implicit-resource-to-string-cast",
            Self::ImplicitToStringCast => "implicit-to-string-cast",
            Self::ImpossibleArrayAccess => "impossible-array-access",
            Self::ImpossibleArrayAssignment => "impossible-array-assignment",
            Self::ImpossibleAssignment => "impossible-assignment",
            Self::ImpossibleCondition => "impossible-condition",
            Self::ImpossibleKeyCheck => "impossible-key-check",
            Self::ImpossibleNonnullEntryCheck => "impossible-nonnull-entry-check",
            Self::ImpossibleNullTypeComparison => "impossible-null-type-comparison",
            Self::ImpossibleTypeComparison => "impossible-type-comparison",
            Self::ImpureConstruct => "impure-construct",
            Self::ImpureStaticVariable => "impure-static-variable",
            Self::IncompatibleConstantAccess => "incompatible-constant-access",
            Self::IncompatibleConstantOverride => "incompatible-constant-override",
            Self::IncompatibleConstantType => "incompatible-constant-type",
            Self::IncompatibleConstantVisibility => "incompatible-constant-visibility",
            Self::IncompatibleParameterCount => "incompatible-parameter-count",
            Self::IncompatibleParameterName => "incompatible-parameter-name",
            Self::IncompatibleParameterType => "incompatible-parameter-type",
            Self::IncompatiblePropertyAccess => "incompatible-property-access",
            Self::IncompatiblePropertyDefault => "incompatible-property-default",
            Self::IncompatiblePropertyHookParameterType => "incompatible-property-hook-parameter-type",
            Self::IncompatiblePropertyHookSignature => "incompatible-property-hook-signature",
            Self::IncompatiblePropertyOverride => "incompatible-property-override",
            Self::IncompatiblePropertyReadonly => "incompatible-property-readonly",
            Self::IncompatiblePropertyStatic => "incompatible-property-static",
            Self::IncompatiblePropertyType => "incompatible-property-type",
            Self::IncompatiblePropertyVisibility => "incompatible-property-visibility",
            Self::IncompatibleReadonlyModifier => "incompatible-readonly-modifier",
            Self::IncompatibleReturnType => "incompatible-return-type",
            Self::IncompatibleStaticModifier => "incompatible-static-modifier",
            Self::IncompatibleTemplateLowerBound => "incompatible-template-lower-bound",
            Self::IncompatibleVisibility => "incompatible-visibility",
            Self::InconsistentTemplate => "inconsistent-template",
            Self::InterfaceInstantiation => "interface-instantiation",
            Self::InvalidArgument => "invalid-argument",
            Self::InvalidArrayAccess => "invalid-array-access",
            Self::InvalidArrayAccessAssignmentValue => "invalid-array-access-assignment-value",
            Self::InvalidArrayElement => "invalid-array-element",
            Self::InvalidArrayElementKey => "invalid-array-element-key",
            Self::InvalidArrayIndex => "invalid-array-index",
            Self::InvalidAssignment => "invalid-assignment",
            Self::InvalidAttributeTarget => "invalid-attribute-target",
            Self::InvalidBreak => "invalid-break",
            Self::InvalidCallable => "invalid-callable",
            Self::InvalidCatchType => "invalid-catch-type",
            Self::InvalidCatchTypeNotClassOrInterface => "invalid-catch-type-not-class-or-interface",
            Self::InvalidClassConstantOnString => "invalid-class-constant-on-string",
            Self::InvalidClassStringExpression => "invalid-class-string-expression",
            Self::InvalidClone => "invalid-clone",
            Self::InvalidConstantSelector => "invalid-constant-selector",
            Self::InvalidContinue => "invalid-continue",
            Self::InvalidDestructuringSource => "invalid-destructuring-source",
            Self::InvalidDocblock => "invalid-docblock",
            Self::InvalidEnumCaseValue => "invalid-enum-case-value",
            Self::InvalidExtend => "invalid-extend",
            Self::InvalidForeachKey => "invalid-foreach-key",
            Self::InvalidForeachValue => "invalid-foreach-value",
            Self::InvalidGeneratorReturnType => "invalid-generator-return-type",
            Self::InvalidGlobal => "invalid-global",
            Self::InvalidImplement => "invalid-implement",
            Self::InvalidIssetExpression => "invalid-isset-expression",
            Self::InvalidIterator => "invalid-iterator",
            Self::InvalidMemberSelector => "invalid-member-selector",
            Self::InvalidMethodAccess => "invalid-method-access",
            Self::InvalidNamedArgument => "invalid-named-argument",
            Self::InvalidOperand => "invalid-operand",
            Self::InvalidOverrideAttribute => "invalid-override-attribute",
            Self::InvalidParentType => "invalid-parent-type",
            Self::InvalidPassByReference => "invalid-pass-by-reference",
            Self::InvalidPropertyAccess => "invalid-property-access",
            Self::InvalidPropertyAssignmentValue => "invalid-property-assignment-value",
            Self::InvalidPropertyRead => "invalid-property-read",
            Self::InvalidPropertyWrite => "invalid-property-write",
            Self::InvalidReturnStatement => "invalid-return-statement",
            Self::InvalidScopeKeywordContext => "invalid-scope-keyword-context",
            Self::InvalidStaticMethodAccess => "invalid-static-method-access",
            Self::InvalidStaticMethodCall => "invalid-static-method-call",
            Self::InvalidStaticPropertyAccess => "invalid-static-property-access",
            Self::InvalidTemplateParameter => "invalid-template-parameter",
            Self::InvalidThrow => "invalid-throw",
            Self::InvalidTraitAliasModifier => "invalid-trait-alias-modifier",
            Self::InvalidTraitUse => "invalid-trait-use",
            Self::InvalidTypeCast => "invalid-type-cast",
            Self::InvalidUnset => "invalid-unset",
            Self::InvalidYieldKeyType => "invalid-yield-key-type",
            Self::InvalidYieldValueType => "invalid-yield-value-type",
            Self::LessSpecificArgument => "less-specific-argument",
            Self::LessSpecificNestedArgumentType => "less-specific-nested-argument-type",
            Self::LessSpecificNestedReturnStatement => "less-specific-nested-return-statement",
            Self::LessSpecificReturnStatement => "less-specific-return-statement",
            Self::ListUsedInReadContext => "list-used-in-read-context",
            Self::MatchArmAlwaysTrue => "match-arm-always-true",
            Self::MatchDefaultArmAlwaysExecuted => "match-default-arm-always-executed",
            Self::MatchExpressionOnlyDefaultArm => "match-expression-only-default-arm",
            Self::MatchNotExhaustive => "match-not-exhaustive",
            Self::MatchSubjectTypeIsNever => "match-subject-type-is-never",
            Self::MethodAccessOnNull => "method-access-on-null",
            Self::MismatchedArrayIndex => "mismatched-array-index",
            Self::MissingConstantType => "missing-constant-type",
            Self::MissingMagicMethod => "missing-magic-method",
            Self::MissingOverrideAttribute => "missing-override-attribute",
            Self::MissingParameterType => "missing-parameter-type",
            Self::MissingPropertyType => "missing-property-type",
            Self::MissingRequiredInterface => "missing-required-interface",
            Self::MissingRequiredParent => "missing-required-parent",
            Self::MissingReturnStatement => "missing-return-statement",
            Self::MissingReturnType => "missing-return-type",
            Self::MissingTemplateParameter => "missing-template-parameter",
            Self::MixedArgument => "mixed-argument",
            Self::MixedArrayAccess => "mixed-array-access",
            Self::MixedArrayAssignment => "mixed-array-assignment",
            Self::MixedArrayIndex => "mixed-array-index",
            Self::MixedAssignment => "mixed-assignment",
            Self::MixedClone => "mixed-clone",
            Self::MixedDestructuringShape => "mixed-destructuring-shape",
            Self::MixedMethodAccess => "mixed-method-access",
            Self::MixedOperand => "mixed-operand",
            Self::MixedPropertyAccess => "mixed-property-access",
            Self::MixedPropertyTypeCoercion => "mixed-property-type-coercion",
            Self::MixedReturnStatement => "mixed-return-statement",
            Self::NameAlreadyInUse => "name-already-in-use",
            Self::NamedArgumentAfterPositional => "named-argument-after-positional",
            Self::NamedArgumentNotAllowed => "named-argument-not-allowed",
            Self::NamedArgumentOverridesPositional => "named-argument-overrides-positional",
            Self::NeverMatchingSwitchCase => "never-matching-switch-case",
            Self::NeverReturn => "never-return",
            Self::NoValidCatchTypeFound => "no-valid-catch-type-found",
            Self::NoValue => "no-value",
            Self::NonClassUsedAsAttribute => "non-class-used-as-attribute",
            Self::NonDocumentedConstant => "non-documented-constant",
            Self::NonDocumentedMethod => "non-documented-method",
            Self::NonDocumentedProperty => "non-documented-property",
            Self::NonExistentAttributeClass => "non-existent-attribute-class",
            Self::NonExistentCatchType => "non-existent-catch-type",
            Self::NonExistentClass => "non-existent-class",
            Self::NonExistentClassConstant => "non-existent-class-constant",
            Self::NonExistentClassLike => "non-existent-class-like",
            Self::NonExistentConstant => "non-existent-constant",
            Self::NonExistentFunction => "non-existent-function",
            Self::NonExistentMethod => "non-existent-method",
            Self::NonExistentProperty => "non-existent-property",
            Self::NonIterableObjectIteration => "non-iterable-object-iteration",
            Self::NonStaticAbstractImplementation => "non-static-abstract-implementation",
            Self::NullArgument => "null-argument",
            Self::NullArrayAccess => "null-array-access",
            Self::NullArrayIndex => "null-array-index",
            Self::NullIterator => "null-iterator",
            Self::NullOperand => "null-operand",
            Self::NullPropertyAccess => "null-property-access",
            Self::NullableReturnStatement => "nullable-return-statement",
            Self::OverrideFinalConstant => "override-final-constant",
            Self::OverrideFinalMethod => "override-final-method",
            Self::OverrideFinalProperty => "override-final-property",
            Self::OverrideFinalPropertyHook => "override-final-property-hook",
            Self::ParadoxicalCondition => "paradoxical-condition",
            Self::ParentOutsideClassScope => "parent-outside-class-scope",
            Self::PossibleMethodAccessOnNull => "possible-method-access-on-null",
            Self::PossiblyFalseArgument => "possibly-false-argument",
            Self::PossiblyFalseIterator => "possibly-false-iterator",
            Self::PossiblyFalseOperand => "possibly-false-operand",
            Self::PossiblyInvalidArgument => "possibly-invalid-argument",
            Self::PossiblyInvalidClone => "possibly-invalid-clone",
            Self::PossiblyInvalidIterator => "possibly-invalid-iterator",
            Self::PossiblyInvalidOperand => "possibly-invalid-operand",
            Self::PossiblyNonExistentProperty => "possibly-non-existent-property",
            Self::PossiblyNullArgument => "possibly-null-argument",
            Self::PossiblyNullArrayAccess => "possibly-null-array-access",
            Self::PossiblyNullArrayIndex => "possibly-null-array-index",
            Self::PossiblyNullIterator => "possibly-null-iterator",
            Self::PossiblyNullOperand => "possibly-null-operand",
            Self::PossiblyNullPropertyAccess => "possibly-null-property-access",
            Self::PossiblyStaticAccessOnInterface => "possibly-static-access-on-interface",
            Self::PossiblyUndefinedArrayIndex => "possibly-undefined-array-index",
            Self::PossiblyUndefinedIntArrayIndex => "possibly-undefined-int-array-index",
            Self::PossiblyUndefinedStringArrayIndex => "possibly-undefined-string-array-index",
            Self::PossiblyUndefinedVariable => "possibly-undefined-variable",
            Self::PropertyTypeCoercion => "property-type-coercion",
            Self::PsalmTrace => "psalm-trace",
            Self::RedundantCast => "redundant-cast",
            Self::RedundantComparison => "redundant-comparison",
            Self::RedundantCondition => "redundant-condition",
            Self::RedundantDocblockType => "redundant-docblock-type",
            Self::RedundantIssetCheck => "redundant-isset-check",
            Self::RedundantKeyCheck => "redundant-key-check",
            Self::RedundantLogicalOperation => "redundant-logical-operation",
            Self::RedundantNonnullEntryCheck => "redundant-nonnull-entry-check",
            Self::RedundantNonnullTypeComparison => "redundant-nonnull-type-comparison",
            Self::RedundantNullCoalesce => "redundant-null-coalesce",
            Self::RedundantNullsafeOperator => "redundant-nullsafe-operator",
            Self::RedundantTypeComparison => "redundant-type-comparison",
            Self::ReferenceConstraintViolation => "reference-constraint-violation",
            Self::ReferenceReusedFromConfusingScope => "reference-reused-from-confusing-scope",
            Self::ReferenceToUndefinedVariable => "reference-to-undefined-variable",
            Self::SelfOutsideClassScope => "self-outside-class-scope",
            Self::SkipInKeyedDestructuring => "skip-in-keyed-destructuring",
            Self::SpreadInDestructuring => "spread-in-destructuring",
            Self::StaticAccessOnInterface => "static-access-on-interface",
            Self::StaticOutsideClassScope => "static-outside-class-scope",
            Self::StringConstantSelector => "string-constant-selector",
            Self::StringMemberSelector => "string-member-selector",
            Self::TemplateConstraintViolation => "template-constraint-violation",
            Self::TooFewArguments => "too-few-arguments",
            Self::TooManyArguments => "too-many-arguments",
            Self::TraitConstantOverride => "trait-constant-override",
            Self::TraitInstantiation => "trait-instantiation",
            Self::TypeConfirmation => "type-confirmation",
            Self::TypeInspection => "type-inspection",
            Self::UndefinedIntArrayIndex => "undefined-int-array-index",
            Self::UndefinedStringArrayIndex => "undefined-string-array-index",
            Self::UndefinedVariable => "undefined-variable",
            Self::UndefinedVariableInClosureUse => "undefined-variable-in-closure-use",
            Self::UnevaluatedCode => "unevaluated-code",
            Self::UnhandledThrownType => "unhandled-thrown-type",
            Self::UnimplementedAbstractMethod => "unimplemented-abstract-method",
            Self::UnimplementedAbstractPropertyHook => "unimplemented-abstract-property-hook",
            Self::UnknownClassInstantiation => "unknown-class-instantiation",
            Self::UnknownConstantSelectorType => "unknown-constant-selector-type",
            Self::UnknownIteratorType => "unknown-iterator-type",
            Self::UnknownMatchSubjectType => "unknown-match-subject-type",
            Self::UnknownMemberSelectorType => "unknown-member-selector-type",
            Self::UnknownYieldFromIteratorType => "unknown-yield-from-iterator-type",
            Self::UnreachableMatchArm => "unreachable-match-arm",
            Self::UnreachableMatchDefaultArm => "unreachable-match-default-arm",
            Self::UnreachableSwitchCase => "unreachable-switch-case",
            Self::UnreachableSwitchDefault => "unreachable-switch-default",
            Self::UnsafeInstantiation => "unsafe-instantiation",
            Self::UnusedFunctionCall => "unused-function-call",
            Self::UnusedMethodCall => "unused-method-call",
            Self::UnusedParameter => "unused-parameter",
            Self::UnusedStatement => "unused-statement",
            Self::UnusedTemplateParameter => "unused-template-parameter",
            Self::UselessControlFlow => "useless-control-flow",
            Self::WhereConstraintViolation => "where-constraint-violation",
            Self::YieldFromInvalidKeyType => "yield-from-invalid-key-type",
            Self::YieldFromInvalidSendType => "yield-from-invalid-send-type",
            Self::YieldFromInvalidValueType => "yield-from-invalid-value-type",
            Self::YieldFromNonIterable => "yield-from-non-iterable",
            Self::YieldOutsideFunction => "yield-outside-function",
        }
    }

    pub fn as_u16(&self) -> u16 {
        *self as u16
    }
}

impl std::str::FromStr for IssueCode {
    type Err = &'static str;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "abstract-class-used-as-attribute" => Ok(Self::AbstractClassUsedAsAttribute),
            "abstract-instantiation" => Ok(Self::AbstractInstantiation),
            "always-matching-switch-case" => Ok(Self::AlwaysMatchingSwitchCase),
            "ambiguous-class-like-constant-access" => Ok(Self::AmbiguousClassLikeConstantAccess),
            "ambiguous-instantiation-target" => Ok(Self::AmbiguousInstantiationTarget),
            "ambiguous-object-method-access" => Ok(Self::AmbiguousObjectMethodAccess),
            "ambiguous-object-property-access" => Ok(Self::AmbiguousObjectPropertyAccess),
            "array-append-in-read-context" => Ok(Self::ArrayAppendInReadContext),
            "array-to-string-conversion" => Ok(Self::ArrayToStringConversion),
            "assignment-to-constant" => Ok(Self::AssignmentToConstant),
            "assignment-to-this" => Ok(Self::AssignmentToThis),
            "attribute-not-repeatable" => Ok(Self::AttributeNotRepeatable),
            "avoid-catching-error" => Ok(Self::AvoidCatchingError),
            "backed-property-reference-hook" => Ok(Self::BackedPropertyReferenceHook),
            "catch-type-not-throwable" => Ok(Self::CatchTypeNotThrowable),
            "class-not-marked-as-attribute" => Ok(Self::ClassNotMarkedAsAttribute),
            "clone-inside-loop" => Ok(Self::CloneInsideLoop),
            "condition-is-too-complex" => Ok(Self::ConditionIsTooComplex),
            "conflicting-reference-constraint" => Ok(Self::ConflictingReferenceConstraint),
            "conflicting-template-equality-bounds" => Ok(Self::ConflictingTemplateEqualityBounds),
            "deprecated-class" => Ok(Self::DeprecatedClass),
            "deprecated-closure" => Ok(Self::DeprecatedClosure),
            "deprecated-constant" => Ok(Self::DeprecatedConstant),
            "deprecated-feature" => Ok(Self::DeprecatedFeature),
            "deprecated-function" => Ok(Self::DeprecatedFunction),
            "deprecated-method" => Ok(Self::DeprecatedMethod),
            "deprecated-trait" => Ok(Self::DeprecatedTrait),
            "direct-trait-constant-access" => Ok(Self::DirectTraitConstantAccess),
            "docblock-type-mismatch" => Ok(Self::DocblockTypeMismatch),
            "duplicate-array-key" => Ok(Self::DuplicateArrayKey),
            "duplicate-caught-type" => Ok(Self::DuplicateCaughtType),
            "duplicate-closure-use-variable" => Ok(Self::DuplicateClosureUseVariable),
            "duplicate-named-argument" => Ok(Self::DuplicateNamedArgument),
            "dynamic-static-method-call" => Ok(Self::DynamicStaticMethodCall),
            "empty-match-expression" => Ok(Self::EmptyMatchExpression),
            "enum-instantiation" => Ok(Self::EnumInstantiation),
            "enum-iteration" => Ok(Self::EnumIteration),
            "excess-template-parameter" => Ok(Self::ExcessTemplateParameter),
            "expression-is-too-complex" => Ok(Self::ExpressionIsTooComplex),
            "extend-final-class" => Ok(Self::ExtendFinalClass),
            "falsable-return-statement" => Ok(Self::FalsableReturnStatement),
            "false-argument" => Ok(Self::FalseArgument),
            "false-iterator" => Ok(Self::FalseIterator),
            "false-operand" => Ok(Self::FalseOperand),
            "generic-object-iteration" => Ok(Self::GenericObjectIteration),
            "hidden-generator-return" => Ok(Self::HiddenGeneratorReturn),
            "implicit-resource-to-string-cast" => Ok(Self::ImplicitResourceToStringCast),
            "implicit-to-string-cast" => Ok(Self::ImplicitToStringCast),
            "impossible-array-access" => Ok(Self::ImpossibleArrayAccess),
            "impossible-array-assignment" => Ok(Self::ImpossibleArrayAssignment),
            "impossible-assignment" => Ok(Self::ImpossibleAssignment),
            "impossible-condition" => Ok(Self::ImpossibleCondition),
            "impossible-key-check" => Ok(Self::ImpossibleKeyCheck),
            "impossible-nonnull-entry-check" => Ok(Self::ImpossibleNonnullEntryCheck),
            "impossible-null-type-comparison" => Ok(Self::ImpossibleNullTypeComparison),
            "impossible-type-comparison" => Ok(Self::ImpossibleTypeComparison),
            "impure-construct" => Ok(Self::ImpureConstruct),
            "impure-static-variable" => Ok(Self::ImpureStaticVariable),
            "incompatible-constant-access" => Ok(Self::IncompatibleConstantAccess),
            "incompatible-constant-override" => Ok(Self::IncompatibleConstantOverride),
            "incompatible-constant-type" => Ok(Self::IncompatibleConstantType),
            "incompatible-constant-visibility" => Ok(Self::IncompatibleConstantVisibility),
            "incompatible-parameter-count" => Ok(Self::IncompatibleParameterCount),
            "incompatible-parameter-name" => Ok(Self::IncompatibleParameterName),
            "incompatible-parameter-type" => Ok(Self::IncompatibleParameterType),
            "incompatible-property-access" => Ok(Self::IncompatiblePropertyAccess),
            "incompatible-property-default" => Ok(Self::IncompatiblePropertyDefault),
            "incompatible-property-hook-parameter-type" => Ok(Self::IncompatiblePropertyHookParameterType),
            "incompatible-property-hook-signature" => Ok(Self::IncompatiblePropertyHookSignature),
            "incompatible-property-override" => Ok(Self::IncompatiblePropertyOverride),
            "incompatible-property-readonly" => Ok(Self::IncompatiblePropertyReadonly),
            "incompatible-property-static" => Ok(Self::IncompatiblePropertyStatic),
            "incompatible-property-type" => Ok(Self::IncompatiblePropertyType),
            "incompatible-property-visibility" => Ok(Self::IncompatiblePropertyVisibility),
            "incompatible-readonly-modifier" => Ok(Self::IncompatibleReadonlyModifier),
            "incompatible-return-type" => Ok(Self::IncompatibleReturnType),
            "incompatible-static-modifier" => Ok(Self::IncompatibleStaticModifier),
            "incompatible-template-lower-bound" => Ok(Self::IncompatibleTemplateLowerBound),
            "incompatible-visibility" => Ok(Self::IncompatibleVisibility),
            "inconsistent-template" => Ok(Self::InconsistentTemplate),
            "interface-instantiation" => Ok(Self::InterfaceInstantiation),
            "invalid-argument" => Ok(Self::InvalidArgument),
            "invalid-array-access" => Ok(Self::InvalidArrayAccess),
            "invalid-array-access-assignment-value" => Ok(Self::InvalidArrayAccessAssignmentValue),
            "invalid-array-element" => Ok(Self::InvalidArrayElement),
            "invalid-array-element-key" => Ok(Self::InvalidArrayElementKey),
            "invalid-array-index" => Ok(Self::InvalidArrayIndex),
            "invalid-assignment" => Ok(Self::InvalidAssignment),
            "invalid-attribute-target" => Ok(Self::InvalidAttributeTarget),
            "invalid-break" => Ok(Self::InvalidBreak),
            "invalid-callable" => Ok(Self::InvalidCallable),
            "invalid-catch-type" => Ok(Self::InvalidCatchType),
            "invalid-catch-type-not-class-or-interface" => Ok(Self::InvalidCatchTypeNotClassOrInterface),
            "invalid-class-constant-on-string" => Ok(Self::InvalidClassConstantOnString),
            "invalid-class-string-expression" => Ok(Self::InvalidClassStringExpression),
            "invalid-clone" => Ok(Self::InvalidClone),
            "invalid-constant-selector" => Ok(Self::InvalidConstantSelector),
            "invalid-continue" => Ok(Self::InvalidContinue),
            "invalid-destructuring-source" => Ok(Self::InvalidDestructuringSource),
            "invalid-docblock" => Ok(Self::InvalidDocblock),
            "invalid-enum-case-value" => Ok(Self::InvalidEnumCaseValue),
            "invalid-extend" => Ok(Self::InvalidExtend),
            "invalid-foreach-key" => Ok(Self::InvalidForeachKey),
            "invalid-foreach-value" => Ok(Self::InvalidForeachValue),
            "invalid-generator-return-type" => Ok(Self::InvalidGeneratorReturnType),
            "invalid-global" => Ok(Self::InvalidGlobal),
            "invalid-implement" => Ok(Self::InvalidImplement),
            "invalid-isset-expression" => Ok(Self::InvalidIssetExpression),
            "invalid-iterator" => Ok(Self::InvalidIterator),
            "invalid-member-selector" => Ok(Self::InvalidMemberSelector),
            "invalid-method-access" => Ok(Self::InvalidMethodAccess),
            "invalid-named-argument" => Ok(Self::InvalidNamedArgument),
            "invalid-operand" => Ok(Self::InvalidOperand),
            "invalid-override-attribute" => Ok(Self::InvalidOverrideAttribute),
            "invalid-parent-type" => Ok(Self::InvalidParentType),
            "invalid-pass-by-reference" => Ok(Self::InvalidPassByReference),
            "invalid-property-access" => Ok(Self::InvalidPropertyAccess),
            "invalid-property-assignment-value" => Ok(Self::InvalidPropertyAssignmentValue),
            "invalid-property-read" => Ok(Self::InvalidPropertyRead),
            "invalid-property-write" => Ok(Self::InvalidPropertyWrite),
            "invalid-return-statement" => Ok(Self::InvalidReturnStatement),
            "invalid-scope-keyword-context" => Ok(Self::InvalidScopeKeywordContext),
            "invalid-static-method-access" => Ok(Self::InvalidStaticMethodAccess),
            "invalid-static-method-call" => Ok(Self::InvalidStaticMethodCall),
            "invalid-static-property-access" => Ok(Self::InvalidStaticPropertyAccess),
            "invalid-template-parameter" => Ok(Self::InvalidTemplateParameter),
            "invalid-throw" => Ok(Self::InvalidThrow),
            "invalid-trait-alias-modifier" => Ok(Self::InvalidTraitAliasModifier),
            "invalid-trait-use" => Ok(Self::InvalidTraitUse),
            "invalid-type-cast" => Ok(Self::InvalidTypeCast),
            "invalid-unset" => Ok(Self::InvalidUnset),
            "invalid-yield-key-type" => Ok(Self::InvalidYieldKeyType),
            "invalid-yield-value-type" => Ok(Self::InvalidYieldValueType),
            "less-specific-argument" => Ok(Self::LessSpecificArgument),
            "less-specific-nested-argument-type" => Ok(Self::LessSpecificNestedArgumentType),
            "less-specific-nested-return-statement" => Ok(Self::LessSpecificNestedReturnStatement),
            "less-specific-return-statement" => Ok(Self::LessSpecificReturnStatement),
            "list-used-in-read-context" => Ok(Self::ListUsedInReadContext),
            "match-arm-always-true" => Ok(Self::MatchArmAlwaysTrue),
            "match-default-arm-always-executed" => Ok(Self::MatchDefaultArmAlwaysExecuted),
            "match-expression-only-default-arm" => Ok(Self::MatchExpressionOnlyDefaultArm),
            "match-not-exhaustive" => Ok(Self::MatchNotExhaustive),
            "match-subject-type-is-never" => Ok(Self::MatchSubjectTypeIsNever),
            "method-access-on-null" => Ok(Self::MethodAccessOnNull),
            "mismatched-array-index" => Ok(Self::MismatchedArrayIndex),
            "missing-constant-type" => Ok(Self::MissingConstantType),
            "missing-magic-method" => Ok(Self::MissingMagicMethod),
            "missing-override-attribute" => Ok(Self::MissingOverrideAttribute),
            "missing-parameter-type" => Ok(Self::MissingParameterType),
            "missing-property-type" => Ok(Self::MissingPropertyType),
            "missing-required-interface" => Ok(Self::MissingRequiredInterface),
            "missing-required-parent" => Ok(Self::MissingRequiredParent),
            "missing-return-statement" => Ok(Self::MissingReturnStatement),
            "missing-return-type" => Ok(Self::MissingReturnType),
            "missing-template-parameter" => Ok(Self::MissingTemplateParameter),
            "mixed-argument" => Ok(Self::MixedArgument),
            "mixed-array-access" => Ok(Self::MixedArrayAccess),
            "mixed-array-assignment" => Ok(Self::MixedArrayAssignment),
            "mixed-array-index" => Ok(Self::MixedArrayIndex),
            "mixed-assignment" => Ok(Self::MixedAssignment),
            "mixed-clone" => Ok(Self::MixedClone),
            "mixed-destructuring-shape" => Ok(Self::MixedDestructuringShape),
            "mixed-method-access" => Ok(Self::MixedMethodAccess),
            "mixed-operand" => Ok(Self::MixedOperand),
            "mixed-property-access" => Ok(Self::MixedPropertyAccess),
            "mixed-property-type-coercion" => Ok(Self::MixedPropertyTypeCoercion),
            "mixed-return-statement" => Ok(Self::MixedReturnStatement),
            "name-already-in-use" => Ok(Self::NameAlreadyInUse),
            "named-argument-after-positional" => Ok(Self::NamedArgumentAfterPositional),
            "named-argument-not-allowed" => Ok(Self::NamedArgumentNotAllowed),
            "named-argument-overrides-positional" => Ok(Self::NamedArgumentOverridesPositional),
            "never-matching-switch-case" => Ok(Self::NeverMatchingSwitchCase),
            "never-return" => Ok(Self::NeverReturn),
            "no-valid-catch-type-found" => Ok(Self::NoValidCatchTypeFound),
            "no-value" => Ok(Self::NoValue),
            "non-class-used-as-attribute" => Ok(Self::NonClassUsedAsAttribute),
            "non-documented-constant" => Ok(Self::NonDocumentedConstant),
            "non-documented-method" => Ok(Self::NonDocumentedMethod),
            "non-documented-property" => Ok(Self::NonDocumentedProperty),
            "non-existent-attribute-class" => Ok(Self::NonExistentAttributeClass),
            "non-existent-catch-type" => Ok(Self::NonExistentCatchType),
            "non-existent-class" => Ok(Self::NonExistentClass),
            "non-existent-class-constant" => Ok(Self::NonExistentClassConstant),
            "non-existent-class-like" => Ok(Self::NonExistentClassLike),
            "non-existent-constant" => Ok(Self::NonExistentConstant),
            "non-existent-function" => Ok(Self::NonExistentFunction),
            "non-existent-method" => Ok(Self::NonExistentMethod),
            "non-existent-property" => Ok(Self::NonExistentProperty),
            "non-iterable-object-iteration" => Ok(Self::NonIterableObjectIteration),
            "non-static-abstract-implementation" => Ok(Self::NonStaticAbstractImplementation),
            "null-argument" => Ok(Self::NullArgument),
            "null-array-access" => Ok(Self::NullArrayAccess),
            "null-array-index" => Ok(Self::NullArrayIndex),
            "null-iterator" => Ok(Self::NullIterator),
            "null-operand" => Ok(Self::NullOperand),
            "null-property-access" => Ok(Self::NullPropertyAccess),
            "nullable-return-statement" => Ok(Self::NullableReturnStatement),
            "override-final-constant" => Ok(Self::OverrideFinalConstant),
            "override-final-method" => Ok(Self::OverrideFinalMethod),
            "override-final-property" => Ok(Self::OverrideFinalProperty),
            "override-final-property-hook" => Ok(Self::OverrideFinalPropertyHook),
            "paradoxical-condition" => Ok(Self::ParadoxicalCondition),
            "parent-outside-class-scope" => Ok(Self::ParentOutsideClassScope),
            "possible-method-access-on-null" => Ok(Self::PossibleMethodAccessOnNull),
            "possibly-false-argument" => Ok(Self::PossiblyFalseArgument),
            "possibly-false-iterator" => Ok(Self::PossiblyFalseIterator),
            "possibly-false-operand" => Ok(Self::PossiblyFalseOperand),
            "possibly-invalid-argument" => Ok(Self::PossiblyInvalidArgument),
            "possibly-invalid-clone" => Ok(Self::PossiblyInvalidClone),
            "possibly-invalid-iterator" => Ok(Self::PossiblyInvalidIterator),
            "possibly-invalid-operand" => Ok(Self::PossiblyInvalidOperand),
            "possibly-non-existent-property" => Ok(Self::PossiblyNonExistentProperty),
            "possibly-null-argument" => Ok(Self::PossiblyNullArgument),
            "possibly-null-array-access" => Ok(Self::PossiblyNullArrayAccess),
            "possibly-null-array-index" => Ok(Self::PossiblyNullArrayIndex),
            "possibly-null-iterator" => Ok(Self::PossiblyNullIterator),
            "possibly-null-operand" => Ok(Self::PossiblyNullOperand),
            "possibly-null-property-access" => Ok(Self::PossiblyNullPropertyAccess),
            "possibly-static-access-on-interface" => Ok(Self::PossiblyStaticAccessOnInterface),
            "possibly-undefined-array-index" => Ok(Self::PossiblyUndefinedArrayIndex),
            "possibly-undefined-int-array-index" => Ok(Self::PossiblyUndefinedIntArrayIndex),
            "possibly-undefined-string-array-index" => Ok(Self::PossiblyUndefinedStringArrayIndex),
            "possibly-undefined-variable" => Ok(Self::PossiblyUndefinedVariable),
            "property-type-coercion" => Ok(Self::PropertyTypeCoercion),
            "psalm-trace" => Ok(Self::PsalmTrace),
            "redundant-cast" => Ok(Self::RedundantCast),
            "redundant-comparison" => Ok(Self::RedundantComparison),
            "redundant-condition" => Ok(Self::RedundantCondition),
            "redundant-docblock-type" => Ok(Self::RedundantDocblockType),
            "redundant-isset-check" => Ok(Self::RedundantIssetCheck),
            "redundant-key-check" => Ok(Self::RedundantKeyCheck),
            "redundant-logical-operation" => Ok(Self::RedundantLogicalOperation),
            "redundant-nonnull-entry-check" => Ok(Self::RedundantNonnullEntryCheck),
            "redundant-nonnull-type-comparison" => Ok(Self::RedundantNonnullTypeComparison),
            "redundant-null-coalesce" => Ok(Self::RedundantNullCoalesce),
            "redundant-nullsafe-operator" => Ok(Self::RedundantNullsafeOperator),
            "redundant-type-comparison" => Ok(Self::RedundantTypeComparison),
            "reference-constraint-violation" => Ok(Self::ReferenceConstraintViolation),
            "reference-reused-from-confusing-scope" => Ok(Self::ReferenceReusedFromConfusingScope),
            "reference-to-undefined-variable" => Ok(Self::ReferenceToUndefinedVariable),
            "self-outside-class-scope" => Ok(Self::SelfOutsideClassScope),
            "skip-in-keyed-destructuring" => Ok(Self::SkipInKeyedDestructuring),
            "spread-in-destructuring" => Ok(Self::SpreadInDestructuring),
            "static-access-on-interface" => Ok(Self::StaticAccessOnInterface),
            "static-outside-class-scope" => Ok(Self::StaticOutsideClassScope),
            "string-constant-selector" => Ok(Self::StringConstantSelector),
            "string-member-selector" => Ok(Self::StringMemberSelector),
            "template-constraint-violation" => Ok(Self::TemplateConstraintViolation),
            "too-few-arguments" => Ok(Self::TooFewArguments),
            "too-many-arguments" => Ok(Self::TooManyArguments),
            "trait-constant-override" => Ok(Self::TraitConstantOverride),
            "trait-instantiation" => Ok(Self::TraitInstantiation),
            "type-confirmation" => Ok(Self::TypeConfirmation),
            "type-inspection" => Ok(Self::TypeInspection),
            "undefined-int-array-index" => Ok(Self::UndefinedIntArrayIndex),
            "undefined-string-array-index" => Ok(Self::UndefinedStringArrayIndex),
            "undefined-variable" => Ok(Self::UndefinedVariable),
            "undefined-variable-in-closure-use" => Ok(Self::UndefinedVariableInClosureUse),
            "unevaluated-code" => Ok(Self::UnevaluatedCode),
            "unhandled-thrown-type" => Ok(Self::UnhandledThrownType),
            "unimplemented-abstract-method" => Ok(Self::UnimplementedAbstractMethod),
            "unimplemented-abstract-property-hook" => Ok(Self::UnimplementedAbstractPropertyHook),
            "unknown-class-instantiation" => Ok(Self::UnknownClassInstantiation),
            "unknown-constant-selector-type" => Ok(Self::UnknownConstantSelectorType),
            "unknown-iterator-type" => Ok(Self::UnknownIteratorType),
            "unknown-match-subject-type" => Ok(Self::UnknownMatchSubjectType),
            "unknown-member-selector-type" => Ok(Self::UnknownMemberSelectorType),
            "unknown-yield-from-iterator-type" => Ok(Self::UnknownYieldFromIteratorType),
            "unreachable-match-arm" => Ok(Self::UnreachableMatchArm),
            "unreachable-match-default-arm" => Ok(Self::UnreachableMatchDefaultArm),
            "unreachable-switch-case" => Ok(Self::UnreachableSwitchCase),
            "unreachable-switch-default" => Ok(Self::UnreachableSwitchDefault),
            "unsafe-instantiation" => Ok(Self::UnsafeInstantiation),
            "unused-function-call" => Ok(Self::UnusedFunctionCall),
            "unused-method-call" => Ok(Self::UnusedMethodCall),
            "unused-parameter" => Ok(Self::UnusedParameter),
            "unused-statement" => Ok(Self::UnusedStatement),
            "unused-template-parameter" => Ok(Self::UnusedTemplateParameter),
            "useless-control-flow" => Ok(Self::UselessControlFlow),
            "where-constraint-violation" => Ok(Self::WhereConstraintViolation),
            "yield-from-invalid-key-type" => Ok(Self::YieldFromInvalidKeyType),
            "yield-from-invalid-send-type" => Ok(Self::YieldFromInvalidSendType),
            "yield-from-invalid-value-type" => Ok(Self::YieldFromInvalidValueType),
            "yield-from-non-iterable" => Ok(Self::YieldFromNonIterable),
            "yield-outside-function" => Ok(Self::YieldOutsideFunction),
            _ => Err("unknown issue code"),
        }
    }
}

impl std::fmt::Display for IssueCode {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl std::convert::TryFrom<&str> for IssueCode {
    type Error = &'static str;

    fn try_from(value: &str) -> Result<Self, Self::Error> {
        <Self as std::str::FromStr>::from_str(value)
    }
}

impl std::convert::From<IssueCode> for &'static str {
    fn from(val: IssueCode) -> Self {
        val.as_str()
    }
}

impl std::convert::From<IssueCode> for String {
    fn from(val: IssueCode) -> Self {
        val.as_str().to_string()
    }
}

impl std::borrow::Borrow<str> for IssueCode {
    fn borrow(&self) -> &'static str {
        self.as_str()
    }
}

impl<'a> std::borrow::Borrow<str> for &'a IssueCode {
    fn borrow(&self) -> &'a str {
        self.as_str()
    }
}
